package com.bdqn.service.impl;

import com.bdqn.mapper.SysRoleMapper;
import com.bdqn.pojo.SysRole;
import com.bdqn.service.SysRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("sysRoleService")
public class SysRoleServiceImpl implements SysRoleService {
    @Resource
    private SysRoleMapper sysRoleMapper;

//    @Transactional(propagation = Propagation.SUPPORTS)
    @Override
    public List<SysRole> selectList(SysRole sysRole) {
        return sysRoleMapper.selectList(sysRole);
    }

//    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int addRole(SysRole sysRole) {
        return sysRoleMapper.addRole(sysRole);
    }

    @Override
    public List<SysRole> getRole() {
        return sysRoleMapper.getRole();
    }

    @Override
    public boolean roleAdd(SysRole sysRole) {
        boolean f = false;
        if (sysRoleMapper.roleAdd(sysRole) > 0){
            f = true;
        }
        return f;
    }

    @Override
    public SysRole roleById(String id) {
        return sysRoleMapper.roleById(id);
    }

    @Override
    public boolean roleUpdate(SysRole sysRole) {
        boolean f  = true;
        if (sysRoleMapper.roleUpdate(sysRole) > 0){
             f = true;
        }
        return f;
    }

    @Override
    public boolean delRole(Integer id) {
        boolean f = false;
        if (sysRoleMapper.delRole(id)>0){
            f = true;
        }
        return f;
    }
}
